BioF439

Final Project

As a program analyst for NIBIB, I get asked to create reports that detail how many grants NIBIB is funding, who is managing different portfolios, and what general trends are being seen over time. This report and dashboard could be used by program staff to determine the number/budget for different grant mechanisms NIBIB has funded and the number/budget for the different program directors over the past 5 years.

library(tidyverse)
## ── Attaching packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.1.0       ✔ purrr   0.3.1  
## ✔ tibble  2.0.1       ✔ dplyr   0.8.0.1
## ✔ tidyr   0.8.3       ✔ stringr 1.4.0  
## ✔ readr   1.3.1       ✔ forcats 0.4.0
## ── Conflicts ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(rio)
library(ggplot2)
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:rio':
## 
##     export
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
nibib <- import('EB_2014-2018_v2.xlsx')

colnames(nibib)[17] <- "PO.name"
colnames(nibib)[47] <- "TC.IC" 

my_theme <- theme_bw

gg1 <- ggplot(
  data=nibib,
  mapping = aes(
     x= FY,
     fill = Activity)) +
         geom_histogram()  +
  my_theme() +
  labs(x = 'Fiscal Year', y = 'Number of Grants', fill = 'Grant Mechanism',
       title = 'NIBIB Awarded Grants', subtitle = 'FY 2014-2018', caption = 'Source: NIH RePORT')


gg2 <- ggplot(
  data = nibib,
  mapping = aes(
    x = FY,
    fill = PO.name)) +
  geom_histogram() +
  my_theme() +
  labs(x = 'Fiscal Year', y = 'Number of Grants', fill = 'PO Name',
       title = 'NIBIB Awarded Grants', subtitle = 'FY 2014-2018', caption = 'Source: NIH RePORT')



gg3 <- ggplot(
  data=nibib,
  aes(x = FY, y = TC.IC/1000000, fill = Activity)) +
  geom_bar(stat="identity") +
  my_theme() +
  labs(x = 'Fiscal Year', y = 'Total Costs (Millions of Dollars)', fill = 'Grant Mechanism',
       title = 'NIBIB Awarded Grants', subtitle = 'FY 2014-2018', caption = 'Source: NIH RePORT')

  

gg4 <- ggplot(
  data=nibib,
  aes(x = FY, y = TC.IC/1000000, fill = PO.name)) +
  geom_bar(stat="identity") +
  my_theme() +
  labs(x = 'Fiscal Year', y = 'Total Costs (Millions of Dollars)', fill = 'PO Name',
       title = 'NIBIB Awarded Grants', subtitle = 'FY 2014-2018', caption = 'Source: NIH RePORT')

plot(gg1)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

plot(gg2)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

plot(gg3)
## Warning: Removed 447 rows containing missing values (position_stack).

plot(gg4)
## Warning: Removed 447 rows containing missing values (position_stack).

ggplotly(gg1)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
ggplotly(gg2)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
ggplotly(gg3)
## Warning: Removed 447 rows containing missing values (position_stack).
ggplotly(gg4)
## Warning: Removed 447 rows containing missing values (position_stack).